/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author hancing.com
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface DpKechengcode extends BasicModel<DpKechengcode> {
  kcid?: string; // 课程ID
  kccode?: string; // 观看码
  uno?: string; // 购买用户
}

export const dpKechengcodeList = (params?: DpKechengcode | any) =>
  defHttp.get<DpKechengcode>({ url: adminPath + '/dp/kccode/dpKechengcode/list', params });

export const dpKechengcodeListData = (params?: DpKechengcode | any) =>
  defHttp.post<Page<DpKechengcode>>({ url: adminPath + '/dp/kccode/dpKechengcode/listData', params });

export const dpKechengcodeForm = (params?: DpKechengcode | any) =>
  defHttp.get<DpKechengcode>({ url: adminPath + '/dp/kccode/dpKechengcode/form', params });

export const dpKechengcodeSave = (params?: any, data?: DpKechengcode | any) =>
  defHttp.postJson<DpKechengcode>({ url: adminPath + '/dp/kccode/dpKechengcode/save', params, data });

export const dpKechengcodeImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/dp/kccode/dpKechengcode/importData',
      onUploadProgress,
    },
    params,
  );

export const dpKechengcodeDelete = (params?: DpKechengcode | any) =>
  defHttp.get<DpKechengcode>({ url: adminPath + '/dp/kccode/dpKechengcode/delete', params });
